<?php

declare(strict_types=1);

namespace Api\InterfaceApi\v1;

use Api\Request\v1\RobotMsgRequest;
use Api\Service\v1\RobotMsgApiService;
use Hyperf\Di\Annotation\Inject;
use Mine\MineApi;

class RobotMsgApi extends MineApi
{
    #[Inject]
    protected RobotMsgApiService  $service;

    /**
     * 发送消息
     * @param RobotMsgRequest $request
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    public function sendMsg(RobotMsgRequest $request): \Psr\Http\Message\ResponseInterface
    {
        return $this->service->sendMsg($request->all()) ? $this->success() : $this->error();
    }
}